WordPress Debug – 查看Query执行的SQL语句

Categories: Development NotesPHPWordPress; Tagged with: ; @ July 20th, 2010 8:58

有时Query不到东西, 怀疑SQL执行有问题时, 可在Query.php适当位置加入Print进行Debug.

具体方法: query.php中:

	 [约L2414]$this->request = apply_filters_ref_array('posts_request', array( $this->request, &$this ) ); [L2414]
print_r("SQL IS: $this->request"); // 打印执行的SQL.
[约L2415]$this->posts = $wpdb->get_results($this->request); [L2416, query.php - function &get_posts()]

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.